import React, {Component} from 'react'
import {Redirect} from 'react-router-dom'
import {TOKEN} from '@/common/Constants';
import {SessionStorage} from '@/utils/storage'

export default (ComponentWrapper) => {
  return class Auth extends Component {
    render() {
      //后续根据菜单权限校验
      let token = SessionStorage.get(TOKEN);
      if (token) {
        return <ComponentWrapper/>
      } else {
        return <Redirect to='/session/login'/>
      }
    }
  }
}
